var MthInstalmentDetailPage = {
	'close': function() {
		var mWindow = MsgBox.getCurrentOpenDialogWindow();
		mWindow.findStatisticInfoAjax.send();
	},
	'onRenderItem': function(colName,text,indexStr,mItem,rowNumber) {
		switch(colName) {
	    case 'isRepay':
	    	return $.buildDatatableCheckbox({
	    		'name': 'isRepay',
	    		'rowNumber': rowNumber,
	    		'id': mItem.id,
	    		'checked': (text == '01'),
	    		'onValueChanged': MthInstalmentDetailPage.onIsRepayValueChanged
	    	});
	    case 'realRepayDate':
	    	var $realRepayDateContainer = $("<div/>");
	    	var realRepayDateId = "realRepayDate_" + rowNumber;
	    	var $realRepayDateInput = $("<input name='remark' data-tag='realRepayDate' type='text' id='" + realRepayDateId + "' data-id='" + mItem.id +"'>");
	    	$realRepayDateInput.attr('readonly', 'readonly');
	    	$realRepayDateInput.val(text);
	    	$realRepayDateContainer.append($realRepayDateInput);
	    	
	    	if (mItem.isRepay == '01') {
	    		var $editRealRepayDateBtn = $("<a href='javascript:void(0)' data-tag='editHandleBtn' data-target='" + realRepayDateId + "' onclick='MthInstalmentDetailPage.editRealRepayDate(this)'><i class='fa fa-fw fa-edit'></i></a>");
	    		$realRepayDateContainer.append($editRealRepayDateBtn);
	    	}
	    	return $realRepayDateContainer;
	    case 'remark':
	    	return $.buildDatatableInput({
	    		'name': 'remark',
	    		'rowNumber': rowNumber,
	    		'id': mItem.id,
	    		'okFunc': MthInstalmentDetailPage.updateRemark,
	    		'text': text,
	    		'width': '222px'
	    	});
		}
	},
	'onIsRepayValueChanged': function(id, checked) {
		var isRepay = checked ? '01': '02';
		updateRepayStateAjax.tempUrl(function(url) {
			return url + id;
		}).setData({
			'isRepay': isRepay
		}).send();
	},
	'editRealRepayDate': function(ele) {
		var targetId = $(ele).data('target');
		var id = $("#" + targetId).data('id');
		MsgBox.open("editRealRepayDate", "修改实际还款日期", ctx + "/expense/realRepayDate/update/" + id + "/index", "300px");
	},
	'updateRemark': function(id, value) {
		updateRemarkAjax.tempUrl(function(url) {
			return url + id;
		}).setData({
			'remark': value
		}).send();
	},
	'updateSucc': function(data, status, xhr) {
		$.messager.info(data.message);
		datatable.refresh(false);
	},
};